#!/usr/bin/env bash

SOURCE=$1
echo "Upgrade region script, SOURCE=$SOURCE"

# Ignore darwin
if [[ ! -d /usr/local/srs-cloud && $(uname -s) == 'Darwin' ]]; then
  echo "Directly finish upgrade for macOS development"
  sleep 3; exit 0;
fi

# Switch the remote for git
if [[ $SOURCE == GITHUB || $SOURCE == github ]]; then
  echo "Change origin to github https://github.com/ossrs/srs-cloud.git"
  git remote set-url origin https://github.com/ossrs/srs-cloud.git
elif [[ $SOURCE == GITEE || $SOURCE == gitee ]]; then
  echo "Change origin to gitee https://gitee.com/ossrs/srs-cloud.git"
  git remote set-url origin https://gitee.com/ossrs/srs-cloud.git
fi

